Android NDK
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
top
The Android Native Development Kit (NDK) provides a cross-compiling tool for compiling code written in C/C++ can be compiled to ARM, or x86 native code (or their 64-bit variants) for Android.cite-ref-4[4]cite-ref-5[5] The NDK uses the Clang compiler to compile C/C++. GCC was included until NDK r17, but removed in r18 in 2018.
Contents
• Overview
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Overview
Native libraries can be called from Java code running under the Android Runtime using System.loadLibrary, part of the standard Android Java classes.cite-ref-6[6]cite-ref-7[7]
Android uses Bionic as its C library, and the LLVM libc++ as its C++ Standard Library. The NDK also includes a variety of other APIs:cite-ref-9[9] zlib compression, OpenGL ES or Vulkan graphics, OpenSL ES audio, and various Android-specific APIs for things like logging, access to cameras, or accelerating neural networks.
The NDK includes support for CMake and its own ndk-build (based on GNU Make). Android Studio supports running either of these from Gradle. Other third-party tools allow integrating the NDK into Eclipsecite-ref-10[10] and Visual Studio.cite-ref-11[11]
For CPU profiling, the NDK also includes simpleperfcite-ref-12[12] which is similar to the Linux perf tool, but with better support for Android and specifically for mixed Java/C++ stacks.
References
cite-note-ndk-developer-11. "Android NDK | Android Developers". Developer.android.com. November 13, 2012. Retrieved March 13, 2014.
cite-note-wikidata-1531cc9399b7a1a77e91108478be42ca9b5aba96-v20-22. "Release NDK r27c · android/ndk · GitHub". Retrieved 26 October 2024.
cite-note-33. "NDK Downloads | Android Developers". developer.android.com. Retrieved 2018-04-24.
cite-note-44. ↑ citerefratabouil2015Ratabouil, Sylvain (2015). Android NDK beginner's guide : discover the native side of Android and inject the power of C/C++ in your applications (2nd ed.). Birmingham. ISBN 978-1-78398-965-2. OCLC 910639612.{{cite book}}: CS1 maint: location missing publisher (link)
cite-note-55. ↑ citerefkosarevsky2013Kosarevsky, Sergey (2013). Android NDK game development cookbook : over 70 exciting recipes to help you develop mobile games for Android in C++. Viktor Latypov. Birmingham. ISBN 978-1-78216-779-2. OCLC 880639342.{{cite book}}: CS1 maint: location missing publisher (link)
cite-note-66. ↑ citerefsrinivas2007Srinivas, Davanum (December 9, 2007). "Android — Invoke JNI based methods (Bridging C/C++ and Java)". Archived from the original on December 16, 2008. Retrieved December 13, 2008.
cite-note-77. ↑ "java.lang.System". Android Developers. Retrieved September 3, 2009.
cite-note-88. ↑ "Android Debug Bridge (adb)".
cite-note-99. ↑ "Android NDK Native APIs | Android NDK".
cite-note-1010. ↑ "Using Eclipse for Android C/C++ Development". January 23, 2011.
cite-note-1111. ↑ "Using Visual Studio to Develop Native Android Code – VisualGDB Tutorials". 30 April 2015.
cite-note-1212. ↑ "Simpleperf | Android NDK".